-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(watch): support watching external files #13087
Conversation
write(&external_file_to_watch, "Hello world2").unwrap(); | ||
|
||
assert_contains!(stderr_lines.next().unwrap(), "Restarting"); | ||
wait_for("Process finished", &mut stderr_lines); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to see what happens with the test if watching doesn't work correctly, it seems like the test will hang forever in this case. Not sure if this is an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @jespertheend! I have only a single nitpick for the help text, but other than that it looks good to me. I will let David review it as well before landing.
Co-authored-by: Bartek Iwańczuk <[email protected]>
Thanks for the review! I didn't really like my wording for the help message tbh, but couldn't think of anything better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jespertheend! Looks good overall, but I think we just need to change watch_arg()
to not take files for subcommands that don't support it.
if let Some(f) = matches.values_of("watch") { | ||
flags.watch = Some(f.map(PathBuf::from).collect()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this still work with deno run --watch
? Is there a unit test that covers this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I see no unit test that covers deno run --watch=file1,file2
, could you add it @jespertheend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deno/cli/tests/integration/watcher_tests.rs
Line 734 in 6c324ac
fn test_watch() { |
deno run --watch
. But now that I think about it, it seems like this shouldn't work. I'll investigate.I'll also add the extra test 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah this works because matches.values_of
returns an empty vec when used as --watch
without any files.
I've added the extra unit test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @jespertheend!
Fixes: #12197